import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-07-05
 * Time: 13:10
 */
public class Test30 {
    public static class ListNode {
        int val;
        ListNode next;

        ListNode(int val) {
            this.val = val;
            next = null;
        }
        ListNode() {

        }
    }

    // 递归写法
//    public static ListNode swapTwo(ListNode head) {
//        if(head == null || head.next == null) {
//            return head;
//        }
//
//        ListNode cur = swapTwo(head.next.next);
//        ListNode tmp = head.next;
//        head.next = cur;
//        tmp.next = head;
//        return tmp;
//    }

    // 非递归写法
    public static ListNode swapTwo(ListNode head) {
        if(head == null || head.next == null) {
            return head;
        }

        ListNode newHead = new ListNode();
        newHead.next = head;
        ListNode pre = newHead;
        ListNode cur = newHead.next;
        ListNode cur1 = cur.next;
        ListNode cur2 = cur1.next;

        while(cur != null && cur1 != null) {
            pre.next = cur1;
            cur1.next = cur;
            cur.next = cur2;

            pre = cur;
            cur = cur2;

            if(cur != null) {
                cur1 = cur.next;
            }
            if(cur1 != null) {
                cur2 = cur1.next;
            }
        }

        return newHead.next;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
       ListNode head = null, tail = null;
        int n = sc.nextInt();
        for(int i = 0; i < n; i++) {
            int val = sc.nextInt();
            ListNode node = new ListNode(val);
            if(head == null) {
                head = node;
            } else {
                tail.next = node;
            }
            tail = node;
        }
        ListNode ret = swapTwo(head);
        while(ret != null) {
            System.out.print(ret.val + " ");
            ret = ret.next;
        }
    }
}
